PriorAuthorization Support System API - Implementation Template
Developer guide
Prior Authorization Developer Guide
Prior Authorization provides helper functions for mapping FHIR objects to X12 ones and reverse.
| Module | Description |
|---|---|
| fhirtoAdditionalInfo275 | Module that provides support for submit 275 request mapping. |
| fhirToSubmitRequest278 | Module that provides support for submit 278 request mapping. |
| submitResponse278toFHIR | Module that provides support for submit 278 response mapping. |
| claimInquiryResponse278toFHIR | Module that provides support for inquiry 278 response mapping. |
| fhirTo278Inquiry | Module that provides support for inquiry 278 request mapping. |
| x12SegmentTools | This module implements X12 segment tools needed for 270 and 271 segments. |
| fhirConstants | This module implements FHIR constants that are used in CoverageEligibilityRequest and Response mapping. |
| x12SegmentQualifiers | This module implements X12 segment qualifier functions. |
fhirtoAdditionalInfo275
Module that provides support for submit 275 request mapping.
fhirToSubmitRequest278
Module that provides support for submit 278 request mapping.
submitResponse278toFHIR
Module that provides support for submit 278 response mapping.
claimInquiryResponse278toFHIR
Module that provides support for inquiry 278 response mapping.
fhirTo278Inquiry
Module that provides support for inquiry 278 request mapping.
x12SegmentTools
This module implements X12 segment tools needed for
270 and 271 segments.
Functions
fun getResource ( resourceBundle, resourceId, resourceType)
param
resourceBundleis the payload bundle to be filtered.
paramresourceIdis the ID of the resource to be used for filtering resources.
paramresourceTypeis the type of resource to be used for filtering resources. Use either resourceId or resourceType for filtering.Function to get resource from bundle using either resourceId or resourceType.
fun createN3 ( n3Type, n301, n302)
param
n3Typeis a string with the N3 type.
paramn301is the first address line.
paramn302is the second address line.
return A formatted N3 address object.Creates a N3 address object with the provided arguments.
fun createN4 ( n4Type, n401, n402, n403, n404, n407)
param
n4Typeis a string with the N$ type.
paramn401is a string with the address city.
paramn402is a string with the address state.
paramn403is a string with the address postal code.
paramn404is a string with the address country.
paramn407is a string with the address district.
return A formatted N4 address object.Creates an N4 address (city, state, zip) object with the provided arguments. Limitation - Doesn't support N407. Assuming address is within United States of America, including its territories, or Canada
fun createDTP ( dtpType, dtp01, dtp02, dtp03)
param
dtpTypeis a string with DTP type.
paramdtp01is a string with DTP qualifier.
paramdtp02is a string with DTP format qualifier.
paramdtp03is a string with DTP value.
return A formatted DTP object.Creates a DTP (date time period) object with the provided arguments.
fun createREF ( refType, ref01, ref02)
param
refTypeis a string with the provider code.
paramref01is a string with the reference identification qualifier.
paramref02is a reference with the ref02 element name being constructed with refType and REF02.
return X12 formatted REF segment.Creates a REF segment with provided arguments.
fun getFHIRResource ( inRequest, resourceId)
param
inRequest- Input request to the API.
paramresourceId- ID of resource to be looked up.
return Resource Object for the matching resource.Function to look up a resource from the bundle based on resource's ID. Example: Pass in an Organization's ID and the response would be the Organization object from the bundle.
fun createPER ( perType, per01, per02, per03, per04, per05, per06, per07, per08)
param
perTypeis a string with the PER type.
paramper01is a string with the function code.
paramper02is a string with the Contact name.
paramper03is a string with the number qualifier.
paramper04is a string with the number value.
paramper05is a string with the second number qualifier.
paramper06is a string with the second number value.
paramper07is a string with the third number qualifier.
paramper08is a string with the third number value.
return A formatted PER contact information object.Creates a PER contact information object with the provided arguments.
fun createSV303 ( inputData)
param
inputDatais a claim resource object.
return A SV303 oral cavity object.Creates a SV303 oral cavity designation object with the provided arguments.
fun createSV3 ( inputData)
param
inputDatais a claim resource object.
return A formatted SV3 dental service object.Creates a SV3 dental service object with the provided arguments.
fun createSV1 ( sv101_01, sv101_02, sv101_03, sv101_04, sv101_05, sv101_06, sv101_07, sv101_08, sv102, sv103, sv104)
param
sv1_1is a string with the EPSDT indicator.
paramsv1_2is a string with product or service ID qualifier.
paramsv1_3is a claim resource object.
return A formatted SV1 professional service object.Creates a SV1 professional service object with the provided arguments.
fun createSBR ( perType, per01, per02, per03, per04, per05, per09)
param
perTypeis a string with the PER type.
paramper01is a string with the Contact Function Code.
paramper02is a string with the Contact name.
paramper03is a string with the Communication Number Qualifier.
paramper04is a string with the Communication Number.
paramper05is a string with the Communication Number Qualifier.
paramper09is a string with the Contact Inquiry Reference.
return A formatted PER contact information object.Creates a SBR contact information object with the provided arguments.
fun genderLookup ( gndr)
param
gndris the string with gender type.
return A required gender value.Formats the provided gender string into a valid gender string that can be cast to the gender value.
fun createDMG ( dmgType, dmg01, dmg02, dmg03)
param
dmgTypeis a string with the DMG type.
paramdmg01is a string with the format qualifier.
paramdmg02is a patient object.
return A formatted DMG demographic information object.Creates a DMG demographic information object with the provided arguments.
fun payerSequenceNumberPayerLookup ( code)
param
gndris the string with gender type.
return A required gender value.Formats the provided gender string into a valid gender string that can be cast to the gender value.
fun relationCodeX12FHIR ( inCode)
param
inCodeX12 relationship code.
return FHIR format relationship code.Function to convert X12 relationship code to FHIR format.
fun genderLookupX12FHIR ( inCode)
param
inCodeX12 Gender code.
return FHIR format Gender code.Function to convert X12 Gender Codes to FHIR format.
fun telecomTypeX12FHIR ( inCode)
param
inCodeX12 relationship code.
return FHIR format relationship code.Function to convert X12 telecom codes to FHIR format.
fun createTelecom ( perSegment)
param
perSegmentPER segment from X12 message.
return telecom object formatted per FHIR specification.Function create telecom object for FHIR resource using X12 PER segment.
fun pluckValuefromSeg ( segment, selector)
param
segmentfrom which the element value is to be extracted.Function to fetch an element from the segment with the key name prefix.
fun createPWK ( pwkType, pwk01, pwk02, pwk05, pwk06)
param
pwkTypeDescribes the PWK segment being mapped.
parampwk01Report Type code.
parampwk02Report Transmission code.
parampwk05Attachment control number.
parampwk06Attachment description.
return X12 formatted BIN segment.Function that creates a PWK segment using the provided parameters.
fun createMSG ( msgType, msg01)
param
msgTypeDescribes the MSG segment being mapped.
parammsg01Message to be written to MSG segment.
return X12 formatted MSG segment.Function create MSG segment using the provided parameters.
fun benefitTypeLookup ( x12BenefitType)
param
x12BenefitType- X12 benefit type.
return FHIR benefit format benefit type.Function to translate X12 benefit type to FHIR format.
fun createPRV ( prvType, prv01, prv02, prv03)
param
prvTypedescribes the provider type being mapped. Not currently in use now, but it could be used if multiple PRV segments with varying fields names are required.
paramprv01is a string with the provider code.
paramprv02is a string with the reference identification qualifier.
paramprv03is a string with the provider taxonomy code.
return X12 formatted PRV segment.Creates a PRV provider information object with the provided arguments.
fun termTypeLookup ( x12TermCode)
param
x12TermCode- X12 term type.
return FHIR format term type.Function to convert term type from X12 to FHIR.
fun createResponseItem ( item, fhirConstants)
param
item- item is the input x12's EB segment.
paramitemCategorySystem- system identifier for item's category.
return - An array of item with benefit and other details.Function to create an item array within CoverageEligibilityResponse.
fun fetchBenefitLoop ( dependentPatientExists, benefitsLoop)
param
dependentPatientExists- Boolean indicating if the patient is the subscriber or dependent.
parambenefitsLoop- X12 271's 2100C or 2100D based on the patient being a dependent or subscriber.Function to fetch the benefits loop based on the patient being a subscriber or a dependent.
fun createCoverageEligibilityResponse ( fhirConstants, covRespId, bhtSegment, patientId, requesterType, requestorId, outcome, payorId, coverageId, benefitPeriod, benefitsLoop, dependentPatientExists)
param
fhirConstants- List of constants used to for identifiers and system.
paramcovRespId- Unique ID for CoverageEligibilityResponse.
parambhtSegment- BHT segment from X12 271 input.
parampatientId- the patient's ID (either subscriber or dependent) from X12 271 2100C Loop.
paramrequesterType- Type of the party sending the CoverageEligibilityRequest can be either Practitioner or Organization.
paramrequestorId- ID of the sender of the CoverageEligibilityRequest.
paramoutcome- Outcome of the 271 X12 based on AAA segment.
parampayorId- ID of the Information Source i.e. the payer in this case.
paramcoverageId- ID of the Coverage created as part of the bundle.
parambenefitPeriod- Benefit begin and end date.
parambenefitsLoop- 2110D or 2110C loop of the X12 271 based on the patient.
paramdependentPatientExists- Boolean indicating if patient is the subscriber or dependent.Function to create CoverageEligibilityResponse.
fun RelationshipLookup ( relateship)
param
relateshipis the string with gender type.
return A required gender value.Formats the provided coverage relationship string into a valid relationship string that can be cast to the relationship value. Limitation: Only supports FHIR relations: Spouse, Child and Other Relationship.
fun createINS ( insType, ins01, ins02)
param
insType- INS segment for patient(subscriber or dependent).
paramins01- insured indicator.
paramins02- relationship to insured.
return An X12 formatted INS segment.Function to create INS segment with provided input parameters.
fun createINS ( insType, ins01, ins02, ins08)
param
ins01is an Insured Indicator value.
paraminso2is value for Individual Relationship Code.
paramins08is a string with Employment Status Code.
return X12 formatted INS segment.Creates an INS object with the provided arguments.
fun insuredRelationLookup ( relCode)
param
relCodeis the code with relationship type.
return A required relationship code.Formats the provided relationship code into a valid code that can be cast to relationship code.
fun createBIN ( bin01)
param
bin01is a Binary Data value.
return X12 formatted BIN segment.Creates a BIN object with the provided arguments.
fun createEFI ( efi01)
param
efi01is a Security Level Code.
return X12 formatted EFI segment.Creates a EFI (Electronic Format Identification) object with the provided arguments.
fun createCAT ( cat01, cat02)
param
cat01is a Attachment Report Type Code.
paramcat02is a Attachment Information Format Code.
return X12 formatted CAT segment.Creates a CAT (Category Of Patient Information Service) object with the provided arguments.
fun createLX ( lx01)
param
lx01is a Assigned Number.
return X12 formatted LX segment.Creates a LX object with the provided arguments.
fun createNX1 ( nx1_01)
param
nx1_01is a Entity Identifier Code.
return X12 formatted NX1 segment.Creates a NX1 object with the provided arguments.
fun providerTypeLookup ( inCode)
param
inCodeFHIR format lookup value.
return X12 format qualifier for provider.Function to convert provider type from FHIR to X12 format.
fun lookupPERCommType ( inCode)
param
inCode- Telecom system in FHIR.
return X12 format communication type qualifier.Function to convert PER segments from FHIR format to X12 format.
fun extensionLookUp ( extension, valueType, url)
param
extension- Array of extensions to be filtered.
paramvalueType- Defines whether extension is of valueCodeableConcept or string.
paramurl- URL of the extension being filtered identifying MilitaryStatus, leveOfService etc.Function to lookup extension using URL comparison and return the appropriate code based on type of extension.
fun fetchSupportingInfo ( supportingInfoArray, eventCode, eventSystem)
param
supportingInfoArray- List of supportinginfos from FHIR PAS Claim Resource.
parameventCode- Codeable concept's code to filter the list.
parameventSystem- Codeable concept's system to filter the list.
return - supportingInfo from FHIR Claim that matches the code and system.Function to fetch claim resource's supporting Info for Patient Event, Admission, Discharge, AdditionalInfo, Message etc.
fun formatPeriod ( periodObject)
param
periodObjectis an FHIR-formatted period object.
return An X12 period range string.X12 formats the period range string with the provided FHIR period object.
fun formatDateTime ( str)
param
stris the current datetime string.
return A datetime formatted string.Formats the provided date string into a valid datetime string that can be cast to a date or a time.
fun createTRN ( trnType, trn01, trn02, trn03, trn04)
param
trnTypeis a string with TRN type.
paramtrn01is value for Trace Type code.
paramtrn02is a string with TRN type Trace Number.
paramtrn03is a string with Trace Assigning Entity Identifier.
paramtrn04is a string with Trace Assigning Entity Additional Identifier.
return X12 formatted TRN segmentCreates a TRN object with the provided arguments.
fun createHI ( hi101, hi102, hi201, hi202)
param
hi101- Diagnosis code classification library identifier.
paramhi102- Diagnosis code.
paramhi201- Diagnosis code classification library identifier.
paramhi202- Diagnosis code.
return An X12 formatted HI segment.Function to create HI segment with provided input parameters.
fun createHI ( hi01, hi02)
param
hi01is a segment qualifier for diagnosys code admitting.
paramhi02is a segment qualifier for diagnosys code principal.
paramhi03is a segment qualifier for diagnosys code patientreasonforvisit.
paramhi04is a string with diagnosys code.Creates a HI healthcare information object with the provided arguments.
fun createUM ( um01, um02, um03, um0401, um0402, um0501, um0504, um06)
param
um01is request category code.
paramum02is certification type code.
paramum03is service type code.
paramum0401is a sub element of UM04 for facility code.
paramum0402is a sub element of UM04 for facility code qualifier.
paramum0501is a sub element of UM05 for related causes code.
paramum0504is a sub element of UM05 for state or province code.
paramum0506is the level of service code.
return X12 formatted UM segment.Creates an UM object with the provided arguments.
fun createSubmit2000ELoop ( inRequest, claimResource, segmentQualifiers, fhirConstantsObj, patientDates, claimSupportingInfo)
Function creates 2000E_Loop and its child loops like 2010EA and 2000F. 2000E_Loop includes TRN, UM, DTP,HI,PWK,MSG, 2010EA_Loop and 2000F_Loop. 2010EA_Loop includes NM1, N3, N4, PER, PRV. 2000F_Loop includes TRN, REF, UM, DTP, SV1 or SV2. This loop can occur in either 2000C at the subscriber level, when the subscriber is the patient, or it can occur at 2000D at the beneficiary level, when a dependent of the subscriber is the patient.
fun getEventLoop ( loop2000E, loop2000FExists)
param
loop2000Eis the 2000ELoop from X12 278 Response
_paramloop2000FExistsis a boolean that identifies presence of 2000FLoop
_return Loop structure of either 2000E or 2000FFunction to get EventLoop from 2000E or 2000F. There are situations where, 2000F loops are not populated in the X12 message. This function looks at both and returns the one that is present
fun getExtensionValue ( LoopESegName, LoopFSegName, LoopE_Element, LoopF_Element, loop2000FExists, loop2000E)
param
LoopESegNameis the segment name from 2000ELoop of X12 278 Response
_paramLoopFSegNameis the segment name from 2000ELoop of X12 278 Response
_paramLoopE_Elementis the element name from 2000ELoop of X12 278 Response
_paramLoopF_Elementis the element name from 2000ELoop of X12 278 Response
_paramloop2000FExistsis a boolean that identifies presence of 2000FLoop
_paramloop2000Eis the 2000ELoop from X12 278 Response
_return Loop structure of either 2000E or 2000FFunction to get extension values segment in either 2000E or 2000F loops. There are situations where, 2000F loops are not populated in the X12 message. with parameters LoopESegName,LoopFSegName,LoopE_Element,LoopF_Element,loop2000FExists,loop2000E This function looks at both and returns the element from 2000F_Loop if it exists else from 2000E_Loop
fun createInquiry2000ELoop ( inRequest, claimResource, segmentQualifiers, fhirConstantsObj, patientDates, claimSupportingInfo)
Function creates 2000E_Loop and its child loops like 2010EA and 2000F. 2000E_Loop includes TRN, DTP, 2010EA_Loop and 2000F_Loop. 2010EA_Loop includes NM1, N3, N4, PER, PRV. 2000F_Loop includes TRN, UM, HCR, REF, DTP, SV1 or SV2. This loop can occur in either 2000C at the subscriber level, when the subscriber is the patient, or it can occur at 2000D at the beneficiary level, when a dependent of the subscriber is the patient.
fun createHCR ( hcr01)
param
hcr01is a string with the action code for HCR.
return X12 formatted HCR segment.Creates a HCR segment with provided arguments.
fhirConstants
This module implements FHIR constants that are used in CoverageEligibilityRequest and Response mapping.
Functions
fun fhirConstants ( )
return A map of constants used.
Gets the constants used in lookup functions.
x12SegmentQualifiers
This module implements X12 segment qualifier functions.
Functions
fun getSegmentQualifiers ( )
return A map of segment qualifiers.
Gets the segment qualifiers for the 270 and 837 transactions.